/
/ Code Section
/
*0200 / Code starts at address 0200
Main, cla cll / clear AC and Link
tad N / load N
cia / negate it
dca Count / deposit it to Count and clear AC
dca X / clear X (AC is zero)
dca Sum / clear Sum (AC is zero)
Loop, isz X / add 1 to X
tad Sum / load Sum (assumes AC is 0)
tad X / add in X
dca Sum / store result in Sum (AC cleared)
isz Count / increment Count and skip on zero
jmp Loop / otherwise loop
hlt / done
jmp Main / allows easy restart
/
/ Data Section
/
*0300 / Data starts at address 0300
N, 12 / N equals 10 decimal
Count, 0 / Loop Counter
X, 0 / Added to Sum
Sum, 0 / Running Sum
$Main / end of pgm - entry point